<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of getwin</title>
  <meta name="keywords" content="getwin">
  <meta name="description" content="GETWIN chooses an appropriate window size for the chessboard corner filter">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- # RADOCCToolbox --><!-- menu.html CornerFinder -->
<h1>getwin
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>GETWIN chooses an appropriate window size for the chessboard corner filter</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function win=getwin(img,pt,crnrpts) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> GETWIN chooses an appropriate window size for the chessboard corner filter
 
 GETWIN chooses the window size depending on the spread of the points. It
 simply chooses a window size which does not include any other points.
 
 USAGE:
     win=getwin(img,pt,crnrpts)
 
 INPUTS:
     img: grayscale image (only used for size)
 
     pt: coordinates of pixel of interest
 
     crnrpts: 2xN array of all other points
 
 OUTPUTS:
     win: window size</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="findnearest.html" class="code" title="function [nxpts,ixs]=findnearest(p,pts,num,same)">findnearest</a>	FINDNEAREST finds from a array of points the nearest to a certain point.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="chesscornerfilter.html" class="code" title="function [crnrs,nocrnrs,peaklocs]=chesscornerfilter(img,imgedge,crnrpts,debug)">chesscornerfilter</a>	CHESSCORNERFILTER filters Harris corners for chessboard corners.</li><li><a href="getsubpixcrnrs.html" class="code" title="function [gridout,win,nobadpts]=getsubpixcrnrs(img,crnrpts,grid)">getsubpixcrnrs</a>	GETSUBPIXCRNRS retruns the subpixel positions of the chessboard corners.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function win=getwin(img,pt,crnrpts)</a>
0002 <span class="comment">% GETWIN chooses an appropriate window size for the chessboard corner filter</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% GETWIN chooses the window size depending on the spread of the points. It</span>
0005 <span class="comment">% simply chooses a window size which does not include any other points.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% USAGE:</span>
0008 <span class="comment">%     win=getwin(img,pt,crnrpts)</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% INPUTS:</span>
0011 <span class="comment">%     img: grayscale image (only used for size)</span>
0012 <span class="comment">%</span>
0013 <span class="comment">%     pt: coordinates of pixel of interest</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%     crnrpts: 2xN array of all other points</span>
0016 <span class="comment">%</span>
0017 <span class="comment">% OUTPUTS:</span>
0018 <span class="comment">%     win: window size</span>
0019 
0020 
0021 x=pt(1);
0022 y=pt(2);
0023 nearestpt=<a href="findnearest.html" class="code" title="function [nxpts,ixs]=findnearest(p,pts,num,same)">findnearest</a>([x;y],crnrpts,1);
0024 win=max(abs(nearestpt-[x;y]))-2;
0025 
0026 <span class="comment">% check for borders</span>
0027 <span class="keyword">if</span> x-win&lt;1
0028     win=x-1;
0029 <span class="keyword">end</span>
0030 <span class="keyword">if</span> x+win&gt;size(img,1)
0031     win=size(img,1)-x;
0032 <span class="keyword">end</span>
0033 <span class="keyword">if</span> y-win&lt;1
0034     win=y-1;
0035 <span class="keyword">end</span>
0036 <span class="keyword">if</span> y+win&gt;size(img,2)
0037     win=size(img,2)-y;
0038 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Sun 04-Apr-2010 17:13:59 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>